Skip to main content

Color Marker System

The Color Marker System is a unique cryptographic validation mechanism in SELF Chain's Proof of AI (PoAI) consensus that provides an additional layer of security and state tracking for wallet addresses and transactions.

Overviewโ€‹

Every wallet in the SELF Chain ecosystem is assigned a color represented as a hexadecimal value. This color serves multiple purposes:

  1. State Tracking: Maintains a continuous state representation of each wallet
  2. Transaction Validation: Provides cryptographic proof of transaction authenticity
  3. Double-Spend Prevention: Ensures transaction uniqueness through color state transitions
  4. Sybil Attack Resistance: Makes it computationally expensive to create multiple valid wallet states

Technical Implementationโ€‹

Wallet Color Assignmentโ€‹

Each wallet address is initialized with a color value derived from its public key:

Initial Color = SHA256(PublicKey) mod 16777216 // Results in 24-bit color (0x000000 to 0xFFFFFF)

Transaction Color Calculationโ€‹

When a transaction is created, the system generates a transaction color through the following process:

  1. Hash Division: The transaction hash is divided into 6 equal parts
  2. Reduction: Each part is reduced to a single hexadecimal character through iterative addition
  3. Combination: The 6 characters are combined to form the transaction's HEX color
TransactionHash = SHA256(sender || receiver || amount || timestamp || nonce)
Parts = SplitIntoSixParts(TransactionHash)
For each part:
While part.length > 1:
part = AddDigitPairs(part) mod 16
TransactionColor = CombineParts(Parts) // 6-digit HEX color

Color State Transitionโ€‹

The wallet's color changes with each transaction according to:

NewWalletColor = (CurrentWalletColor + TransactionColor) mod 16777216

This creates a deterministic state progression that can be verified by any node in the network.

Validation Processโ€‹

Block Builder Responsibilitiesโ€‹

  1. Color Calculation: For each transaction in the block, calculate the new wallet color
  2. State Update: Include the expected post-transaction wallet colors in the block
  3. Merkle Proof: Generate a Merkle tree of color transitions for efficient verification

AI Validator Verificationโ€‹

The AI validator selected for color-marker validation performs:

  1. Independent Calculation: Recalculate all color transitions for transactions in the block
  2. State Verification: Compare calculated colors with those provided by the block builder
  3. Consensus Participation: Vote on block validity based on color marker correctness

Selection Algorithmโ€‹

The validator for color-marker validation is selected using:

ValidatorIndex = SHA256(BlockHash || PreviousBlockHash || Round) mod EligibleValidatorCount

Where eligible validators are those who:

  • Are active and have sufficient stake
  • Did not vote for the winning block builder
  • Have participated in recent manual voting rounds

Security Propertiesโ€‹

Cryptographic Strengthโ€‹

  • Collision Resistance: Uses SHA256 hashing to prevent color collision attacks
  • Deterministic: Color transitions are fully deterministic and verifiable
  • Forward Security: Previous color states cannot be derived from current states

Attack Mitigationโ€‹

  1. Double-Spend Prevention: Each transaction creates a unique color transition that can only occur once
  2. State Manipulation: Tampering with transaction order or content results in different color outcomes
  3. Validator Collusion: Random validator selection prevents predictable collusion opportunities

Integration with PoAIโ€‹

The color marker system integrates seamlessly with other PoAI components:

AI Learningโ€‹

  • AI validators learn patterns in color transitions to detect anomalies
  • Historical color data helps train models for fraud detection
  • Color clustering analysis identifies related wallet behaviors

Manual Voting Integrationโ€‹

When users participate in manual voting:

  • Their wallet's color history influences validator selection
  • Active participation maintains favorable color transition patterns
  • Inactive wallets may experience color "fading" penalties

Performance Considerationsโ€‹

Computational Efficiencyโ€‹

  • Color calculations use simple modular arithmetic
  • State storage requires only 3 bytes per wallet
  • Verification can be parallelized across transactions

Scalabilityโ€‹

  • Color states can be checkpointed periodically
  • Light clients can verify transactions using color proofs
  • Sharding compatible through color-based partition schemes

Example Implementationโ€‹

// Simplified color marker calculation
pub fn calculate_new_wallet_color(
current_color: u32,
transaction_hash: &[u8; 32]
) -> u32 {
// Divide hash into 6 parts
let parts: Vec<&[u8]> = transaction_hash.chunks(6).take(6).collect();

// Reduce each part to single hex digit
let mut hex_digits = Vec::new();
for part in parts {
let mut sum = 0u32;
for &byte in part {
sum += byte as u32;
}
hex_digits.push(sum % 16);
}

// Combine into transaction color
let transaction_color = hex_digits.iter()
.enumerate()
.fold(0u32, |acc, (i, &digit)| {
acc + (digit << (4 * (5 - i)))
});

// Calculate new wallet color
(current_color + transaction_color) % 0x1000000
}

Future Enhancementsโ€‹

Planned Improvementsโ€‹

  1. Multi-dimensional Colors: Extend to RGB+Alpha for richer state representation
  2. Color Gradients: Implement smooth transitions for related transactions
  3. Dynamic Color Spaces: Adjust color space based on network activity
  4. Privacy Features: Zero-knowledge proofs for color transitions

Research Areasโ€‹

  • Quantum-resistant color calculations
  • Cross-chain color interoperability
  • AI-driven color prediction models
  • Color-based smart contract triggers

Conclusionโ€‹

The Color Marker System provides SELF Chain with a unique and powerful mechanism for maintaining wallet state integrity while enabling efficient validation through the PoAI consensus mechanism. By combining cryptographic security with visual metaphors, it creates an intuitive yet robust approach to blockchain state management.